// Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.

// 首页相关查询
package homepage

import (
	"fleetmanager/api/common/log"
	"fleetmanager/api/response"
	"fleetmanager/api/service/homepage"
	"fleetmanager/logger"
	"net/http"

	"github.com/beego/beego/v2/server/web"
)

type HomepageController struct {
	web.Controller
}

func (h *HomepageController) QueryFleetRuntimeState() {
	tLogger := log.GetTraceLogger(h.Ctx).WithField(logger.Stage, "query fleet runtime state")
	s := homepage.NewHomepageService(h.Ctx, tLogger)
	rsp, errC := s.ShowHomepageInfo()
	if errC != nil {
		response.ServiceError(h.Ctx, errC)
		return
	}
	response.Success(h.Ctx, http.StatusOK, rsp)
}